
#include "PIT1.h"


Key_CB* Key_CBbuf[20] = { NULL };
uint8 Keybufindex = 0;


uint8  AddKeyCB(Key_CB* _Key_CB)
{
    if (Keybufindex >= 20) return 0;

    Key_CBbuf[Keybufindex] = _Key_CB;

    Keybufindex++;
    return  1;
}

void PIT1_Init()
{
    pit_ms_init(PIT_CH1, 20);
    interrupt_set_priority(PIT_IRQn, 1);
}



void PIT1_handler()
{
    for (size_t i = 0; i < Keybufindex; i++)
    {
        KeyRuning(Key_CBbuf[i]);
    }
}
